/*
用户登录的路由组件
 */
import React, {Component} from 'react'
import {Button, InputItem, List, NavBar, Radio, WhiteSpace, WingBlank} from "antd-mobile"
import Logo from "../../components/logo/logo"

export default class Login extends Component {
    state = {
        username:'',
        password:''
    }

    // 处理输入的数据
    handleChange = (name,value) => {
        this.setState({
            [name]:value, // 属性名不是name, 而是name变量的值
        })
    }

    // 如果还没有账户，去注册界面
    toRegister = () => {
        this.props.history.replace('/register')
    }

    render() {
        return (
            <div>
                <NavBar>招&nbsp;聘&nbsp;APP</NavBar>
                <Logo />
                <WingBlank>
                    <List>
                        <InputItem placeholder='请输入用户名' onChange={val => this.handleChange('username',val)}>用户名：</InputItem>
                        <WhiteSpace />
                        <InputItem placeholder='请输入密码' onChange={val => this.handleChange('password',val)}>密&emsp;码：</InputItem>
                        <WhiteSpace />
                        <WhiteSpace />
                        <WhiteSpace />
                        <Button type='primary'>登&emsp;录</Button>
                        <WhiteSpace />
                        <Button onClick={this.toRegister}>还没有账户</Button>
                    </List>
                </WingBlank>
            </div>
        )
    }
}
